package com.lucnn.diamond.spring.config;


import com.lucnn.diamond.spring.bean.Car;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

/**
 * 1.指定初始化销毁initMethod,destroyMethod=> xml中:init-method="" destroy-method=""
 * 2.实现InitializingBean DisposableBean
 * 3.JSR250 @PostConstruct @PreDestory
 * 4.BeanPostProcessor
 *      spring底层实现也是依靠BeanPostProcessor，比如@Autowried @Async
 */

@Configuration
@ComponentScan("com.lucnn.diamond")
public class LifeCycleConfig {

    @Bean(initMethod = "init" ,destroyMethod = "over")
    public Car car(){
        return new Car();
    }
}
